<?php
class Conta
{
	public function mostraContas(){
		echo '<script>
		document.ReceiverProperties.action=\'_response/call.php?get=Operative/receiveraccount\';
		subform(\'ReceiverProperties\',\'AC_List\');</script>';
	}
	private function depositoEmConta(){
		if(isset($_POST['AID']) && $_POST['AID'] > 0) {
				
			mn_field('button','ED','Null_Ac','Escolher Outra Conta','','','','SUBMIT" onclick="
			document.ReceiverProperties.AID.value=\'\';
			document.ReceiverProperties.action=\'_response/call.php?get=cliente/conta\';
			subform(\'ReceiverProperties\',\'inv_MP\');
			document.getElementById(\'OrderProp\').innerHTML=\'\';');
		}
		mn_field('button','ED','FMAC','Nova Conta','100','38','','SUBMIT"
		onClick=" document.ReceiverProperties.AID.value=\'\';
		document.ReceiverProperties.action=\'_response/call.php?get=Operative/view/viewreceiveraccount\';
		subform(\'ReceiverProperties\',\'NWAC\');');

		if($_POST['AccViewMode']==0) {
				
			mn_field('button','ED','FMAC','Ver Bloqueados','100','38','','SUBMIT" onClick="
			document.ReceiverProperties.AID.value=\'\';
			document.ReceiverProperties.AccViewMode.value=1;
			document.ReceiverProperties.action=\'_response/call.php?get=cliente/conta\';
			document.getElementById(\'OrderProp\').innerHTML=\'\';
			subform(\'ReceiverProperties\',\'inv_MP\');
			document.ReceiverProperties.action=\'_response/call.php?get=Operative/receiveraccount\';
			subform(\'ReceiverProperties\',\'AC_List\');');
		} else {
				
			mn_field('button','ED','FMAC','Esconder Bloqueados','100','38','','SUBMIT" onClick="
			document.ReceiverProperties.AID.value=\'\';
			document.ReceiverProperties.AccViewMode.value=0;
			document.ReceiverProperties.action=\'_response/call.php?get=cliente/conta\';
			document.getElementById(\'OrderProp\').innerHTML=\'\';
			subform(\'ReceiverProperties\',\'inv_MP\');
			document.ReceiverProperties.action=\'_response/call.php?get=Operative/receiveraccount\';
			subform(\'ReceiverProperties\',\'AC_List\');');
		}
		$this->mostraContas();
	}
	private function entregaAoBalcao(){
		echo '<script>
				document.ReceiverProperties.action=\'_response/call.php?get=Operative/list_corragencies\';
				subform(\'ReceiverProperties\',\'AC_List\');
			</script>'; 
	}
	public function __construct() { if (!isset($_POST['RID']))
	{
		$_POST['RID'] = $OBJCTRC; }
		echo '<div style="float: left">';
		$ordemDePagamento=$_POST['ORP'];
		switch($ordemDePagamento) {
			case 1:$this->depositoEmConta();break;
			case 2: $this->entregaAoBalcao();break;
			default:echo '<script>document.getElementById(\'AC_List\').innerHTML=\'\';</script>';
		}
		echo '</div><div style="float: right; clear: both">';
		if ($_POST['CST'] == 0) {
			mn_field('select','ED','ORP',$_POST['ORP'],"SELECT mp_ID AS ID,
			mp_ModoPago AS NAME FROM hd_modospago WHERE mp_Flag = 1",'','','"
			onchange=" document.getElementById(\'OrderProp\').innerHTML=\'\';
			document.getElementById(\'NWAC\').innerHTML=\'\';
			document.ReceiverProperties.action=\'_response/call.php?get=Operative/conta\';
			subform(\'ReceiverProperties\',\'inv_MP\');');
		}
		echo '</div>';
	}
}
